#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
    int a,b;
    while(~scanf("%d%d",&a,&b)){
        if(a==0 && b==0){
            break;
        }
        if(a>b){
            swap(a,b);
        }
        if(a==floor((b-a)*(sqrt(5.0)+1)/2)){
            printf("0\n");
        }
        else{
            printf("1\n");
            int ta=a;
            int tb=b;
            while(ta-- && tb--){
                //printf("---%d %d\n",ta,tb);
                if(ta==floor((tb-ta)*(sqrt(5.0)+1)/2)){
                    printf("%d %d\n",ta,tb);
                }
            }
            ta=a;
            tb=b;
            while(tb--){
                //printf("--%d %d\n",ta,tb);
                //printf("%d\n",min(ta,tb)==floor((max(ta,tb)-min(ta,tb))*(sqrt(5.0)+1)/2));
                if(min(ta,tb)==floor((max(ta,tb)-min(ta,tb))*(sqrt(5.0)+1)/2)){
                    //printf("zheli\n");
                    printf("%d %d\n",min(ta,tb),max(ta,tb));
                }
            }
        }
    }
    return 0;
}